{{ $pressPath := (printf "data/%s/press/press.toml" $.Language.Lang) }}

{{ $translatedPressEnabled := false }}

{{ $pressData := "" }}
{{ if $translatedPressEnabled -}}
  {{ $data := index .Site.Data $.Language.Lang }}
  {{ $pressData = $data.press }}
{{ else }}
  {{ $dataDefaultLanguage := index .Site.Data .Sites.First.Language.Lang }}
  {{ $pressData = $dataDefaultLanguage.press }}
{{ end }}

{{ with $pressData.press }}
  {{ $pressCounter := 0 }}
  {{ $pressMonthCounter := 1 }}
  {{ $pressMonthPrev := false }}
  {{ range (sort .press "date" "desc") }}
    {{ if lt $pressCounter 5 }}
      {{ $pressMonthCur := dateFormat "2006-01" .date }}
      {{ if eq $pressMonthCur $pressMonthPrev }}
        {{ $pressMonthCounter = add $pressMonthCounter 1 }}
      {{ else }}
        {{ $pressMonthCounter = 1 }}
      {{ end }}
    <p>
      <span class="txtdate">{{ dateFormat "2006-01" .date }}</span>
      <br />
      <a href="{{ if $translatedPressEnabled }}{{ .Site.BaseURL | relLangURL }}{{ else }}{{ $.Site.BaseURL }}{{ end }}press/#{{ dateFormat "2006-01" .date }}:{{ $pressMonthCounter }}">{{ .name }}</a>
    </p>
      {{ $pressCounter = add $pressCounter 1 }}
      {{ $pressMonthPrev = $pressMonthCur }}
    {{ end }}
  {{ end }}
{{ end }}
